package com.jiezuo.demos_poi;

import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.data.Pictures;

import java.io.File;
import java.io.FileOutputStream;
import java.util.HashMap;

/**
 *@Description
 *@Author 庞留杰
 *@Date2024/11/11 8:43
 *@Version V1.0
 **/
public class PoiTl {

    final static String template = "D:\\data\\poi\\PoiTl模版.docx";
    final static String generate = "D:\\data\\poi\\PoiTl生成效果.docx";
    final static String image = "D:\\data\\poi\\image.jpg";

    public static void main(String[] args) throws Exception {
        XWPFTemplate xwpfTemplate = XWPFTemplate.compile(new File(template)).render(
                new HashMap<String, Object>() {{
                    put("image", Pictures.ofLocal(image).size(200, 200).create());
                }});
        xwpfTemplate.writeAndClose(new FileOutputStream(generate));
    }

}
